<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link type="text/css" href="../../css/intro.css" rel="stylesheet" >
<link type="text/css" href="../../js/jDialog/jDialog.css" rel="stylesheet" >
<script type="text/javascript" src="../../js/jDialog/jquery.dialog.js"></script>
<script type="text/javascript" src="../../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../js/form/jquery.form.js"></script>
<script type="text/javascript" src="../../js/ajaxfileupload.js"></script>
<title>Insert title here</title>
</head>
<script type="text/javascript">
$(document).ready(function() {
	var userObj =window.userObj;
	var resumeObj = null;
	var userId = userObj[0].userId;
	gUserId=userId;
	
	$.ajax({
		type : 'post',
		dataType : 'text',
		async: false,
		url : '../../resume/getResInfoByUserId.action',
		data : {
			"resumeDTO.userDTO.userId":gUserId
		},
		success : function(msg) {
			if(msg.length>4){
				resumeObj = JSON.parse(msg);
				$("#resumeDTO\\.resumeId").val(resumeObj[0].resumeId);
				$("#resumeDTO\\.learningExperience").val(resumeObj[0].learningExperience);
				$("#resumeDTO\\.projectExperience").val(resumeObj[0].projectExperience);
				$("#resumeDTO\\.honor").val(resumeObj[0].honor);
				$("#resumeDTO\\.hobby").val(resumeObj[0].hobby);
				$("#resumeDTO\\.jobPosition").val(resumeObj[0].jobPosition);
				$("#resumeDTO\\.headPhoto").val(resumeObj[0].headPhoto);
				if(resumeObj[0].headPhoto=="" || resumeObj[0].headPhoto.length<=2){
					document.getElementById("idPhoto").src="../../images/minion.png";
				}else{
					document.getElementById("idPhoto").src = resumeObj[0].headPhoto;
				}
				$("#resumeDTO\\.resumeRemarks").val(resumeObj[0].resumeRemarks);
			}
		}
	});
	$("#userDTO\\.userId").val(userObj[0].userId);
	$("#userDTO\\.userPwd").val(userObj[0].userPwd);
	$("#userDTO\\.userStatus").val(userObj[0].userStatus);
	$("#userDTO\\.userPhoto").val(userObj[0].userPhoto);
	$("#userDTO\\.userRemarks").val(userObj[0].userRemarks);
	$("#userDTO\\.userLoginName").val(userObj[0].userLoginName);
	$("#userDTO\\.userNickName").val(userObj[0].userNickName);
	$("#userDTO\\.userNation").val(userObj[0].userNation);
	$("#userDTO\\.homePlace").val(userObj[0].homePlace);
	$("#userDTO\\.userBirthday").val(userObj[0].userBirthday);
	$("#userDTO\\.userPolitics").val(userObj[0].userPolitics);
	$("#userDTO\\.userSchool").val(userObj[0].userSchool);
	$("#userDTO\\.userEducaBack").val(userObj[0].userEducaBack);
	$("#userDTO\\.userMajor").val(userObj[0].userMajor);
	$("#userDTO\\.userEnglish").val(userObj[0].userEnglish);
	$("#userDTO\\.userPhone").val(userObj[0].userPhone);
	$("#userDTO\\.userEmail").val(userObj[0].userEmail);
	$("#userDTO\\.userQq").val(userObj[0].userQq);
	$("#userDTO\\.userAddress").val(userObj[0].userAddress);
	
});

$.subResume = function(){
		var options = {
				type : 'post',
				dataType : 'text',
				url : '../../resume/updateIntroduce.action',
				success : function(msg) {
					if(msg==1){
						var dialog = jDialog.dialog({
							title : '提示信息',
							content : '信息修改成功！'
						});
					}
					else{
						var dialog = jDialog.dialog({
							title : '提示信息',
							content : '信息修改失败！'
						});
					}
				}
			}
		$("#introForm").ajaxSubmit(options);
};
$.uploadheadPhoto = function(){
	var dialog = jDialog.confirm("<span style='font-weight:bold;font-size:15px;'>照片上传</span><br\><input type='file' id='fromPhotoupload' onchange='$.checkFileType(this)' name='file'/>",{
		handler : function(button,dialog) {
			$.uploadFromPhoto();
			dialog.close();
		}
	},{
		handler : function(button,dialog) {
			dialog.close();
		}
	});
}
$.uploadFromPhoto = function() {
	if (typeof ($("#fromPhotoupload").val()) != 'undefined'
			&& $("#fromPhotoupload").val() != '') {
		$.ajaxFileUpload({
			url : '../../uploadf/uploadHeadPhoto.action', //用于文件上传的服务器端请求地址
			secureuri : false, //是否需要安全协议，一般设置为false
			fileElementId : 'fromPhotoupload', //文件上传域的ID
			dataType : 'HTML', //返回值类型 一般设置为json
			success : function(data, status) //服务器成功响应处理函数
			{
				document.getElementById("idPhoto").src=data;
				$("#resumeDTO\\.headPhoto").val(data);
			},
			error : function(data, status, e)//服务器响应失败处理函数
			{
				alert("上传失败");
			}
		})
	} else {
		alert("请先选择图片！");
	}
}
//判断上传文件的类型
$.checkFileType = function(obj) {
	var extend = obj.value.substring(obj.value.lastIndexOf(".") + 1);
	if (!(extend == "jpg" || extend == "JPG" || extend == "png"
			|| extend == "PNG" || extend == "jpeg" || extend == "JPEG"
			|| extend == "gif" || extend == "GIF" || extend == "bmp" || extend == "BMP")) {
		alert("请上传图片类型的文件!");
		var nf = obj.cloneNode(true);
		nf.value = '';
		obj.parentNode.replaceChild(nf, obj);
		return false;
	}
	return true;
}
</script>
<body>
<div class="mineInfo">
<span id="info1">我的简历&nbsp;RESUME</span>
<hr style="height:1px;border:none;border-top:1px solid #555555;" />
</div>
<div id="introduce">
<form method="post" name="introForm" id="introForm">
<table border="1">
<tr>
<td rowspan="8">个人<br/><br/>资料</td>
</tr>
<tr>
<td>姓名</td>
<td><input id="userDTO.userNickName" name="userDTO.userNickName" type="text"/></td>
<td>性别</td>
<td><input  name="userDTO.userSex" type="radio" value="1" checked="checked"/>男<input name="userDTO.userSex" type="radio" value="0"/>女</td>
<td rowspan="7"><img style="width:150px;" id="idPhoto" onclick="$.uploadheadPhoto()"/></td>
</tr>
<tr>
<td>民族</td>
<td><input  id="userDTO.userNation" name="userDTO.userNation" type="text"/>
<td>籍贯</td>
<td><input  id="userDTO.homePlace" name="userDTO.homePlace" type="text"/>
</tr>
<tr>
<td>出生年月</td>
<td><input type="text" id="userDTO.userBirthday" name="userDTO.userBirthday"></td>
<td>政治面貌</td>
<td><select name="userDTO.userPolitics" id="userDTO.userPolitics"><option selected="selected" value="群众">群众</option>
	<option value="共青团员">共青团员</option><option value="预备党员">预备党员</option><option value="党员">党员</option></select></td>

</tr>
<tr>
<td>毕业院校</td>
<td><input type="text" id="userDTO.userSchool" name="userDTO.userSchool"></td>
<td>学历</td>
<td><select name="userDTO.userEducaBack" id="userDTO.userEducaBack"><option selected="selected" value="本科">本科</option>
	<option value="研究生">研究生</option><option value="硕士">硕士</option><option value="博士">博士</option><option value="其他">其他</option></select></td>
</tr>
<tr>
<td>专业</td>
<td><input type="text" id="userDTO.userMajor" name="userDTO.userMajor"></td>
<td>英语水平</td>
<td><input type="text" id="userDTO.userEnglish" name="userDTO.userEnglish"/></td>
</tr>
<tr>
<td>联系电话</td>
<td><input type="text" id="userDTO.userPhone" name="userDTO.userPhone"></td>
<td>邮件地址</td>
<td><input type="text" id="userDTO.userEmail" name="userDTO.userEmail"/></td>
</tr>
<tr>
<td>QQ</td>
<td><input type="text" id="userDTO.userQq" name="userDTO.userQq"></td>
<td>住址/邮编</td>
<td><input type="text" id="userDTO.userAddress" name="userDTO.userAddress"/></td>
</tr>
<tr>
<td >学习经历</td>
<td colspan="6"><textArea id="resumeDTO.learningExperience" name="resumeDTO.learningExperience"></textArea></td>
</tr>
<tr>
<td>项目经历</td>
<td colspan="6"><textArea id="resumeDTO.projectExperience" name="resumeDTO.projectExperience"></textArea></td>
</tr>
<tr>
<td>校园荣誉</td>
<td colspan="6"><textArea id="resumeDTO.honor" name="resumeDTO.honor"></textArea></td>
</tr>
<tr>
<td>兴趣爱好</td>
<td colspan="6"><textArea id="resumeDTO.hobby" name="resumeDTO.hobby"></textArea></td>
</tr>
</table>
<input type="button" value="保存修改" onclick="$.subResume()" style="margin-left:50%;font-family:'微软雅黑';width:100px;background:#6C6C6C;color:white;"/>
<input type="hidden" id="resumeDTO.resumeId" name="resumeDTO.resumeId">
<input type="hidden" id="userDTO.userId" name="userDTO.userId">
<input type="hidden" id="userDTO.userLoginName" name="userDTO.userLoginName">
<input type="hidden" id="userDTO.userPwd" name="userDTO.userPwd">
<input type="hidden" id="userDTO.userStatus" name="userDTO.userStatus">
<input type="hidden" id="userDTO.userPhoto" name="userDTO.userPhoto">
<input type="hidden" id="userDTO.userRemarks" name="userDTO.userRemarks">
<input type="hidden" id="resumeDTO.jobPosition" name="resumeDTO.jobPosition">
<input type="hidden" id="resumeDTO.headPhoto" name="resumeDTO.headPhoto">
<input type="hidden" id="resumeDTO.resumeRemarks" name="resumeDTO.resumeRemarks">
</form>
</div>
</body>
</html>